package yxy.cherry.battle.module.affix.buff;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.AffixFactory.BuffTypeEnum;
import yxy.cherry.battle.module.affix.Buff;
import yxy.cherry.battle.module.affix.BuffType;
import yxy.cherry.battle.module.record.stream.RecordStream;
import yxy.cherry.battle.module.record.stream.RecordStream_33_HOT回春;
import yxy.cherry.battle.module.record.stream.RecordStream_BUF;
import yxy.cherry.data.bean.skill;

/** 回春 */
@BuffType(Type = BuffTypeEnum.回春)
public class Affix_53_回春 extends Buff {

	long 跳血值 = 0;

	private int get治疗比例() {
		return getParam(0);
	}

	public Affix_53_回春(Fighter source, Fighter target, skill skilldata, int[] params) {
		super(source, target, skilldata, params);
		跳血值 = source.get攻击() * get治疗比例() / VALUE_比率分母;
	}

	@Override
	public RecordStream record() {
		return getRecord().stream(new RecordStream_BUF(getActor(),getActor().getBuffMap().get(this.getBuffCodeSeq())));
	}

	@Override
	public boolean exec(Fighter source, Fighter actor) {
		if (!actor.is活着()) {
			return false;
		}

		actor.set治疗(跳血值);

		// 流脚本
		getRecord().stream(new RecordStream_33_HOT回春(actor, 跳血值)).record();

		Battle.battleLogger(6,"回春："+actor.getName()+"施法者"+source.getName()+"攻击"+source.get攻击()+"治疗比例"+get治疗比例()+"回血了："+跳血值);
		return true;
	}

	@Override
	public BuffStateType getBuffStateType() {
		return BuffStateType.回春状态;
	}
}